package com.may.wlrj.crypto;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;

public interface GXUSBKeyAbs extends Library{
	//GXUSBKeyAbs instanceDll  = (GXUSBKeyAbs)Native.loadLibrary(VerifyLicense.webInfPath + "/SKF_usb_ms_x86_64_19.1128_with_log",GXUSBKeyAbs.class);
	
	int SKF_EnumDev(boolean bPresent,byte[] szNameList,IntByReference pulSize);
	int SKF_ConnectDev(byte[] szName,PointerByReference phDev);
	int SKF_GetDevInfo(Pointer hDev,S_DEVINFO.ByReference pDevInfo);
	int SKF_SetSymmKey(Pointer hDev,byte[] pbkey,int ulAlgId,PointerByReference phKey);
	int SKF_EncryptInit(Pointer hkey,BLOCKCIPHERPARAM EncryptParam);
	int SKF_EncryptUpdate(Pointer hKey, byte[] pbData, int ulDataLen, byte[] pbEncryptedData, IntByReference pulEncryptedLen);
	int SKF_EncryptFinal (Pointer hKey, byte[] pbEncryptedData, IntByReference ulEncryptedDataLen );
	//int SKF_Encrypt(Pointer hkey, byte[] pbData, int ulDataLen, Pointer pbEncryptedData,IntByReference pulEncrypedLen);
	int SKF_DecryptInit(Pointer hkey,BLOCKCIPHERPARAM DecryptParam);
	int SKF_DecryptUpdate(Pointer hKey, byte[] pbEncryptedData, int ulEncryptedLen, byte[] pbData, IntByReference pulDataLen);
	int SKF_DecryptFinal (Pointer hKey, byte[] pbDecryptedData, IntByReference pulDecryptedDataLen);
	//int SKF_Decrypt(Pointer hkey, byte[] pbEncryptedData, int ulEncrypedLen, Pointer pbData,IntByReference pulDataLen);
	int SoftSM4_Crypto(int ulAlgID, boolean isEncrypt, byte[] pbData, int ulDataLen, byte[] pbKey, byte[] pbIV, byte[] pbOutData, IntByReference pulDataLen);
	int SKF_CloseHandle(Pointer hDev);
}
